package org.edu.modules.classSchedule.service.impl;

import org.edu.modules.classSchedule.entity.VeJwJsbpksz;
import org.edu.modules.classSchedule.mapper.VeJwJsbpkszMapper;
import org.edu.modules.classSchedule.service.IVeJwJsbpkszService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 教室不排课时间
 * @Author:
 * @Date:   2021-05-12
 * @Version: V1.0
 */
@Service
public class VeJwJsbpkszServiceImpl extends ServiceImpl<VeJwJsbpkszMapper, VeJwJsbpksz> implements IVeJwJsbpkszService {
    @Autowired
    private VeJwJsbpkszMapper veJwJsbpkszMapper;

    @Override
    @Transactional
    public boolean setNoScheduleForRoom(List<VeJwJsbpksz> veJwJsbpkszs,String classroomid) {
        try {
            veJwJsbpkszMapper.deleteAll(classroomid);
            for (VeJwJsbpksz veJwJsbpksz : veJwJsbpkszs) {
                //veJwBpksj.setId(null);
                veJwJsbpkszMapper.insert(veJwJsbpksz);
            }
            return true;
        }
        catch (Exception ex){
            return false;
        }
    }
}
